//友链配置详情
toConfiguredetails()
function toConfiguredetails() {
    $.ajax({
        url:root.sroreinter.queryLinkAppyDetail,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify({

            "id":sessionStorage.getItem("id"),

        }),
        success: function (data) {
        var shuju =data.applyDetail

        if (shuju!=""||shuju!=null) {

            if(shuju.examStatus==10){
                $("#examReason").removeAttr("readonly");

                $("#buttons").css({
                    display: "block"
                });
            }else {
                $("#buttons").css({
                    display: "none"
                });
                $("#examReason").attr("readonly", "readonly");

                $("#examUserNames").css({
                    display: "inline"
                });
                $("#examTimes").css({
                    display: "inline"
                });
                $("#examUserName").css({
                    display: "inline"
                });
                $("#examTime").css({
                    display: "inline"
                });
            }
            if(shuju.examStatus==10){
                $("#examStatus").html("待审核")
            }else if(shuju.examStatus==20){
                $("#examStatus").html("已通过")
            }else if(shuju.examStatus==30){
                $("#examStatus").html("已拒绝")
            }
            $("#linkName").html(shuju.linkName)
            $("#linkUrl").html(shuju.linkUrl)
            $("#telephone").html(shuju.telephone)
            $("#email").html(shuju.email)
            $("#introduce").html(shuju.introduce)
            $("#examReason").val(shuju.examReason)
            if(shuju.examTime=="1000-01-01 00:00:00.0"){
                $("#examTime").html("")
            }else {
                $("#examTime").html(shuju.examTime)
            }
            $("#examUserName").html(shuju.examUserName)

        }

        },

    });
}
//通过
function adopt() {

    $.ajax({
        url:root.sroreinter.auditLinkAppy,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        contentType: "application/json",
        data: JSON.stringify({
            "id":sessionStorage.getItem("id"),
            "examStatus":20,
            "examReason":$("#examReason").val(),
            "examUserId":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
            "examUserName":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
        }),
        success: function (data) {
            if(data.code==0){
                $.Huimodalalert("通过成功",2000);
                toConfiguredetails()
            }else {

                $.Huimodalalert(data.msg,2000);

            }
        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    })
}


//拒绝
function refuse() {

    $.ajax({
        url:root.sroreinter.auditLinkAppy,
        cache: false,  //禁用缓存
        type: "POST",
        dataType:'json',
        contentType: "application/json",
        data: JSON.stringify({
            "id":sessionStorage.getItem("id"),
            "examStatus":30,
            "examReason":$("#examReason").val(),
            "examUserId":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.user_ID,
            "examUserName":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
        }),
        success: function (data) {
            if(data.code==0){
                $.Huimodalalert("拒绝成功",2000);
                toConfiguredetails()
            }else {

                $.Huimodalalert(data.msg,2000);

            }
        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    })
}
